﻿<!--
	Copyright 2012 Douglas Harber

    This file is part of TSW.CombatTracker.

    TSW.CombatTracker is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    TSW.CombatTracker is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with TSW.CombatTracker.  If not, see <http://www.gnu.org/licenses/>.
-->
<Window x:Class="TSW.CombatTracker.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
		xmlns:l="clr-namespace:TSW.CombatTracker;assembly="
		xmlns:diag="clr-namespace:System.Diagnostics;assembly=WindowsBase"
		Title="TSW Combat Tracker"
		Foreground="White" Background="Transparent"
		Left="{Binding Source={x:Static l:Properties.Settings.Default}, Path=MainWindowLeft, Mode=TwoWay}"
		Top="{Binding Source={x:Static l:Properties.Settings.Default}, Path=MainWindowTop, Mode=TwoWay}"
		Width="577" Height="388"
		ResizeMode="NoResize" SizeToContent="WidthAndHeight"
		Topmost="True" AllowsTransparency="True" WindowStyle="None">
	<Window.Style>
		<Style TargetType="Window">
			<Style.Triggers>
				<DataTrigger Binding="{Binding ElementName=TransparentButton, Path=IsChecked}" Value="True">
					<Setter Property="Opacity" Value="0.4" />
				</DataTrigger>
			</Style.Triggers>
		</Style>

	</Window.Style>

	<Window.Resources>
		<Style x:Key="TitleBarStyle" TargetType="DockPanel">
			<!--<Setter Property="Background" Value="{StaticResource DarkHeaderBrush}" />-->
		</Style>

		<Style x:Key="TransparentButtonStyle" TargetType="ToggleButton">
			<Style.Triggers>
				<Trigger Property="IsChecked" Value="False">
					<Setter Property="Opacity" Value="0.4" />
				</Trigger>
			</Style.Triggers>
		</Style>

		<Style x:Key="ContentPanelStyle" TargetType="Grid">
		</Style>

		<SolidColorBrush x:Key="LightHeaderBrush" Color="#E8E8E8" />

		<SolidColorBrush x:Key="DarkHeaderBrush" Color="#808080" />

		<SolidColorBrush x:Key="LightContentBrush" Color="Black" />

	</Window.Resources>

	<Window.CommandBindings>
		<CommandBinding Command="ApplicationCommands.Close"
                        Executed="CloseCommandHandler" />
		<CommandBinding Command="{x:Static l:CommandActions.GenerateScripts}"
						Executed="GenerateScriptsHandler" />
	</Window.CommandBindings>

	<Grid x:Name="AppPanel" Background="Black" LayoutUpdated="AppPanel_LayoutUpdated">
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto" />
			<RowDefinition Height="*" />
		</Grid.RowDefinitions>

		<!-- Title bar -->
		<DockPanel Background="{StaticResource DarkHeaderBrush}" LastChildFill="False" Grid.Row="0">
			<TextBlock Text="{Binding Title, RelativeSource={RelativeSource FindAncestor, AncestorType=Window}}" Padding="4" DockPanel.Dock="Left">
				<TextBlock.ToolTip>
					<TextBlock>Copyright 2012 Doug Harber (dharber+tsw@pobox.com)</TextBlock>
				</TextBlock.ToolTip>
			</TextBlock>
			<TextBlock Text="{Binding Path=CombatLog.Name, StringFormat=- {0}}" Padding="0,4,4,4" />

			<Button x:Name="CloseButton" Command="ApplicationCommands.Close" Width="16" Height="16" Margin="0,4,8,4" DockPanel.Dock="Right">
				<Button.ToolTip>Close</Button.ToolTip>
				<!-- TODO: Add button images -->
			</Button>

			<ToggleButton x:Name="MinButton" Width="16" Height="16" Margin="0,4,4,4" DockPanel.Dock="Right"
							  Checked="MinButton_Checked" Unchecked="MinButton_Unchecked">
				<ToggleButton.ToolTip>Minimize</ToggleButton.ToolTip>
				<!-- TODO: Add button images -->
			</ToggleButton>

			<ToggleButton x:Name="TransparentButton" IsChecked="False" Width="16" Height="16" Margin="4,4,4,4" DockPanel.Dock="Right">
				<ToggleButton.ToolTip>Transparent</ToggleButton.ToolTip>
				<!-- TODO: Add button images -->
			</ToggleButton>

			<!-- Removed Script button for now since script generation is pretty weak -->
			<!--<Button x:Name="ScriptsButton" Command="{x:Static l:CommandActions.GenerateScripts}" Width="16" Height="16" Margin="0,4,12,4" DockPanel.Dock="Right">
				<Button.ToolTip>Generate scripts</Button.ToolTip>
			</Button>-->

			<Button x:Name="ClearButton" Click="ClearButton_Click" Width="16" Height="16" Margin="0,4,16,4" DockPanel.Dock="Right">
				<Button.ToolTip>Clear statistics</Button.ToolTip>
				<!-- TODO: Add button images -->
			</Button>

			<ToggleButton x:Name="RunButton" Checked="RunButton_Checked" Unchecked="RunButton_Unchecked" Width="16" Height="16" Margin="4,4,4,4" DockPanel.Dock="Right">
				<ToggleButton.ToolTip>Process combat log</ToggleButton.ToolTip>
				<!-- TODO: Add button images -->
			</ToggleButton>

		</DockPanel>

		<Grid Name="ContentPanel" Style="{StaticResource ContentPanelStyle}" Grid.Row="1">
			<l:CombatDisplay x:Name="CombatDisplay" DataContext="{Binding Combat}" Background="{StaticResource LightContentBrush}" />
		</Grid>

	</Grid>
</Window>
